import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import*

testCase="DBshop016_商品管理管理分类前台侧边设置-删除"
firefox=openBrowser(urlAdmin) #调用自定义函数打开网页,url的值是在testData文件中定义的
#调用自定义函数进行后台的登录
DBshopLoginAdmin(firefox)
# 依次点击"商品管理","管理分类","前台侧边设置
DBshopEnterMenu3(firefox,"商品管理","管理分类","前台侧边设置")
# 点击删除
firefox.find_element_by_xpath("//td[contains(.,'网站很好看')]/following-sibling::td[3]/a[2]").click()
firefox.switch_to.alert.accept()
time.sleep(5)
# 断言：找不到商品分类就测试成功
try:
    firefox.find_element_by_xpath("//td[contains(.,'网站很好看')]")
    writeLog("%s 测试失败"%testCase)
except:
    writeLog("%s 测试通过" % testCase)
    getPhoto(firefox)
firefox.quit()









